<template>
  <div>
    <!-- 搜索 -->
    <search />

    <!-- 轮播图 -->
    <swiper :data="data" />

    <!-- 分类 -->
    <category :data="data" />

    <!-- 广告 -->
    <ad :data="data" />

    <!-- 推荐 -->
    <recommend :data="data" />

    <tabBar />
  </div>
</template>

<script>
import search from "./search.vue";
import swiper from "./swiper.vue";
import category from "./category.vue";
import ad from "./ad.vue";
import recommend from "./recommend.vue";
import { getIndexInfo } from "@/apis/home.js";
export default {
  components: {
    search,
    swiper,
    category,
    ad,
    recommend,
  },
  data() {
    return {
      data: {}, //首页的数据
    };
  },
  async created() {
    let res = await this.$http.get(getIndexInfo);
    this.data = res.data.data;
    // console.log(this.data);
  },
};
</script>

<style></style>
